//
//  GXWebConViewController.m
//  SXH
//
//  Created by 龚啸 on 15/12/28.
//  Copyright © 2015年 lyss. All rights reserved.
//

#import "GXWebConViewController.h"
#import "YYAnimationIndicator.h"
#import "MBProgressHUD.h"
#import "MainTbaBarController.h"
#import "AppDelegate.h"
@interface GXWebConViewController (){
    MBProgressHUD *HUD;
    YYAnimationIndicator *indicator;
}
@property (nonatomic, strong) IBOutlet UIWebView *webViewContent;
@property (nonatomic, strong) IBOutlet UILabel *labelTitle;
@end

@implementation GXWebConViewController
@synthesize url, vcTitle;
@synthesize webViewContent;
- (void)viewDidLoad {
    [super viewDidLoad];
    indicator = [[YYAnimationIndicator alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2-40, SCREEN_HEIGHT/2-40, 80, 57)];
    [indicator setLoadText:Loading_Text];
    [self.view addSubview:indicator];
    
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    [webViewContent loadRequest:request];
    
    [webViewContent stringByEvaluatingJavaScriptFromString:@"document.body.style.zoom=0.5"];
    [webViewContent setScalesPageToFit:YES];
    [indicator startAnimation];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [indicator startAnimation] ;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [indicator stopAnimationWithLoadText:HasLoaded_Text withType:YES];
}
- (IBAction)doBack:(id)sender {
    MainTbaBarController *vc =[[MainTbaBarController alloc]init];
    
    [[AppDelegate instance].window changeRootViewController:vc];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
